package com.seu.project.seuquiz.model.converter;

import com.seu.project.seuquiz.model.dto.userScoreMap.UserScoreMapUpdateRequest;
import com.seu.project.seuquiz.model.entity.UserScoreMap;

/**
 * @author SoftPro
 * @createDate: 2023-07-16 14:24
 */
public class UserScoreMapConverter {

    /**
     * 将 UserScoreMapQueryRequest 转换为 UserScoreMap 对象
     * @param request
     * @return
     */
    public static UserScoreMap userScoreMapQueryRequestToUserScoreMap(UserScoreMapUpdateRequest request) {
        if (request == null) {
            return null;
        }

        return UserScoreMap.builder()
                .id(request.getId())
                .studentId(request.getStudentId())
                .contestId(request.getContestId())
                .times(request.getTimes())
                .time(request.getTime())
                .score(request.getScore())
                .build();
    }
}
